package com.example.myapplication.data

import android.content.Context
import com.example.myapplication.api.BackendApiClient
import com.example.myapplication.model.Stock
import com.example.myapplication.model.StockPrice

/**
 * 使用后端 API 的股票数据仓库
 * 所有业务逻辑由后端处理，前端只负责调用和显示
 */
class BackendStockRepository(context: Context) : IStockRepository {
    
    private val apiClient = BackendApiClient(context)
    
    override suspend fun getPopularStocks(): List<Stock> {
        return apiClient.getPopularStocks()
    }
    
    override suspend fun getStockHistory(symbol: String, days: Int): List<StockPrice> {
        return apiClient.getStockHistory(symbol, days)
    }
    
    override suspend fun searchStocks(query: String): List<Stock> {
        return apiClient.searchStocks(query)
    }
}

